import "./fonts/simhei.ttf";
import { System,Route,DateTime,ImageResouse} from "./globals.slint";
import { HomeView } from "./home.slint";
import { AboutView } from "./about.slint";
import { GifView } from "./gif.slint";
export { System, ImageResouse}

export global MyState {
    in-out property <bool> is_show : true;
}
export global LocalTime {
    in-out property <string> h : "00";
    in-out property <string> m : "分钟";
    in-out property <string> s : "秒数";

}

export component MainView inherits Window {
    background: black;
    default-font-family: "黑体";
    width: 128px;
    height: 64px;
    Rectangle {
        x:0px;
        y:0px;
        width: 100%;
        height: 100%;
        background: transparent;
        border-color: white;
        border-width: 5px;
    }

    HorizontalLayout {
        padding: 5px;
        height: 100%;
        if System.current_page == Route.Home: HomeView{}
        if System.current_page == Route.About: AboutView{}
        if System.current_page == Route.Gif: GifView{}
    }

/*    Timer {
        running: true;
        interval: 2s;
        triggered => {
            *//*if (System.current_page == Route.About){
                System.current_page = Route.Home;
            }else{
                System.current_page = Route.About;
            }*//*
            System.next_page();
        }
    }*/

    Timer {
        running: true;
        interval: 1s;
        triggered => {
            DateTime.seconds+=1;
            if (DateTime.seconds == 60){
                DateTime.minutes+=1;
                DateTime.seconds = 1;
            }
            if(DateTime.minutes == 60){
                DateTime.hours += 1;
                DateTime.minutes =1;
            }
        }
    }
    /*Timer {
        running: true;
        interval: 4s;
        triggered => {
            DateTime.minutes+=1;
        }
    }*/
}

